const chart_bar_option={
    legend: {},
    tooltip: {},
    dataset: {
      source: [
        ["product", "出勤人数", "缺勤人数", "迟到人数"],
        ["周一", 43.3, 85.8, 93.7],
        ["周二", 83.1, 73.4, 55.1],
        ["周三", 86.4, 65.2, 82.5],
        ["周四", 72.4, 53.9, 39.1],
        ["周五", 72.4, 53.9, 39.1]
      ]
    },
    xAxis: { type: "category" },
    yAxis: {},
    series: [{ type: "bar" }, { type: "bar" }, { type: "bar" }]
}

const detail_calendar = {
  workdays: [
    {
      description: "事假",
      dates: { start: new Date(2021, 0, 1), end: new Date(2021, 0, 10) },
      color: "blue"
    },
    {
      description: "病假",
      dates: { start: new Date(2021, 0, 14), end: new Date(2021, 0, 18) },
      color: "green"
    },
    {
      description: "迟到",
      dates: { start: new Date(2021, 0, 15), end: new Date(2021, 0, 23) },
      color: "red"
    },
    {
      description: "旷工",
      dates: { start: new Date(2021, 0, 24), end: new Date(2021, 0, 25) },
      color: "orange"
    }
  ]
};

const chart_percent_option = {
  tooltip: {
    trigger: "item",
    formatter: "{a} <br/>{b}: {c} ({d}%)"
  },
  legend: {
    orient: "vertical",
    left: 10,
    data: ["出勤天数", "休假天数", "事假天数", "病假天数", "出差天数"]
  },
  series: [
    {
      name: "我的考勤",
      type: "pie",
      radius: ["50%", "70%"],
      avoidLabelOverlap: false,
      label: {
        show: false,
        position: "center"
      },
      emphasis: {
        label: {
          show: true,
          fontSize: "30",
          fontWeight: "bold"
        }
      },
      labelLine: {
        show: false
      },
      data: [
        { value: 335, name: "出勤天数" },
        { value: 310, name: "休假天数" },
        { value: 234, name: "事假天数" },
        { value: 135, name: "病假天数" },
        { value: 1548, name: "出差天数" }
      ]
    }
  ]
};

module.exports = [
  //考勤统计图数据
  {
    url: "/attendance/chart_bar",
    type: "get",
    result:()=> {
      return {
        code: 200,
        data: {
          option:chart_bar_option
        }
      };
    }
  },

  //获取员工考勤信息
  {
    url: "/attendance/detail_calendar",
    type: "get",
    result: () => {
      return {
        code: 200,
        data: detail_calendar
      };
    }
  },

  //员工考勤统计百分比
  {
    url: "/attendance/chart_percent",
    type: "post",
    result: () => {
      return {
        code: 200,
        data: {
          option: chart_percent_option
        }
      };
    }
  }
];
